package com.lecloud.api.connect;

import java.util.Map;

import cn.edu.live.util.TimeUtil;

import com.alibaba.fastjson.JSONObject;
import com.lecloud.constant.Const;
import com.lecloud.model.PublicParam;
import com.lecloud.util.LeCloudVerify;
import com.lecloud.util.Sender;

/**
 * 获取直播流地址
 * 
 * @author zhagz
 * 
 */
public class ObtainPushAddr {

	private static final String obtainPushAddr_method = "lecloud.cloudlive.activity.getPushUrl";
	private static final String obtainPushAddr_ver = "4.0";

	public JSONObject getPushAddr(String activityId) {
		Map<String, String> map = PublicParam.getPublicParamMap(obtainPushAddr_method, obtainPushAddr_ver,
				Const.userid, TimeUtil.currentTime());
		map.put("activityId", activityId);

		String sign = LeCloudVerify.getSign(map);
		map.put("sign", sign);
		JSONObject js = Sender.get(Const.common_url, map);

		return js;
	}
}
